<template>
  <el-row v-loading="loading">
    <p><span>通道状态：</span><span class="fz12 tip">{{ le.enter_status }}</span></p>
    <p><span>状态信息：</span><span class="fz12 err">{{ le.error_info }}</span></p>
    <p>经营地址：{{ le.area }}</p>
    <p>详细地址：{{ le.address }}</p>
    <p>行业类型：{{ le.mcc }}</p>
    <p>渠道选择：{{ le.balance_type }}</p>
    <h4 v-if="le.card === 3" class="tip">POS机支付</h4>
    <p v-if="le.card === 3">借记卡D+1费率：{{ le.credit_d1 }} %</p>
    <p v-if="le.card === 3">借记D+1封顶金额：{{ le.debit_money }} 元</p>
    <p v-if="le.card === 3">借记卡D+0费率：{{ le.credit_d0 }} %</p>
    <p v-if="le.card === 3">贷记卡D+1费率：{{ le.debit_d1 }} %</p>
    <p v-if="le.card === 3">贷记卡D+0费率：{{ le.debit_d0 }} %</p>
    <p v-if="le.card === 3">境外卡D+0费率：{{ le.ovsea_d0 }} %</p>
    <p v-if="le.card === 3">境外卡D+1费率：{{ le.ovsea_d1 }} %</p>
    <p><span style="vertical-align: top;">证件信息：</span></p>
    <div>
      <img width="100" height="100" title="租赁协议或房产证明" v-if="le.channel_lepos_place_evid" :src="le.channel_lepos_place_evid">
      <img width="100" height="100" title="入网协议" v-if="le.channel_lepos_netprot" :src="le.channel_lepos_netprot">
      <img width="100" height="100" title="食品卫生许可证" v-if="le.store_licence_hyg" :src="le.store_licence_hyg">
      <img width="100" height="100" title="协议书" v-if="le.ch_lpos_certi" :src="le.ch_lpos_certi">
    </div>
    <h4 class="tip">移动支付</h4>
    <p>微信通道签约费率T+0：{{ le.rates_t0.wx }} %</p>
    <p>微信通道签约费率T+1：{{ le.rates_t1.wx }} %</p>
    <p>支付宝通道签约费率T+0：{{ le.rates_t0.ali }} %</p>
    <p>支付宝通道签约费率T+1：{{ le.rates_t1.ali }} %</p>
  </el-row>
</template>

<script>
import { verfiryChannelLeQuery } from '@/api/shop'

export default {
  data() {
    return {
      loading: true,
      le: {
        area: '',
        address: '',
        mcc: '',
        balance_type: '',
        channel_lepos_netprot: '',
        channel_lepos_place_evid: '',
        debit_d1: '',
        debit_d0: '',
        credit_d1: '',
        credit_d0: '',
        ovsea_d1: '',
        ovsea_d0: '',
        channel_lepos_agreement: '',
        store_licence_hyg: '',
        rates_t0: {
          wx: '',
          ali: ''
        },
        rates_t1: {
          wx: '',
          ali: ''
        },
        enter_status: null,
        error_info: ''
      }
    }
  },
  methods: {
    handleDocumentInit() {
      verfiryChannelLeQuery(this.$route.query.merchant_num).then(res => {
        if (res.data.errorCode === 0) {
          this.loading = false
          this.le.area = res.data.result.area.name.toString()
          this.le.address = res.data.result.address
          this.le.mcc = res.data.result.mcc.name
          this.le.balance_type = res.data.result.balance_type
          this.le.credit_d1 = Number(res.data.result.pos_rates.credit.d1.rate)
          this.le.credit_d0 = Number(res.data.result.pos_rates.credit.d0.rate)
          this.le.debit_d1 = Number(res.data.result.pos_rates.debit.d1.rate)
          this.le.debit_d0 = Number(res.data.result.pos_rates.debit.d0.rate)
          this.le.ovsea_d0 = Number(res.data.result.pos_rates.ovsea.d0.rate)
          this.le.ovsea_d1 = Number(res.data.result.pos_rates.ovsea.d1.rate)
          this.le.debit_money = Number(res.data.result.pos_rates.debit.d1.ceiling)
          this.le.channel_lepos_agreement = res.data.result.photo.channel_lepos_agreement
          this.le.store_licence_hyg = res.data.result.photo.store_licence_hyg
          this.le.rates_t0 = res.data.result.rates_t0
          this.le.rates_t1 = res.data.result.rates_t1
          this.le.error_info = res.data.result.enter_status.error_info
          this.le.enter_status = res.data.result.enter_status.name
          this.le.channel_lepos_netprot = res.data.result.photo.channel_lepos_netprot
          this.le.channel_lepos_place_evid = res.data.result.photo.channel_lepos_place_evid
        } else {
          this.$message.error(res.data.errorMsg)
        }
      })
    }
  },
  created() {
    this.handleDocumentInit()
  }
}
</script>
